<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="/permission" prefix="pe" %>

<jsp:include page="../../include/top.jsp"/>
<div class="main_body">
    <div class="span9 page_message">
        <section id="contents">
            <ul class="tab-nav nav">
                <li class="current">
                    <a href="">产品列表<span class="arrow fa fa-sort-up"></span></a>
                </li>
                <li>
                    <a href="${BasePath}/order/product/toAdd?${PublicParams}">产品添加/修改<span class="arrow fa fa-sort-up"></span></a>
                </li>
                <li>
                    <a href="${BasePath}/order/product/toProductInstitution?${PublicParams}">批量更新产品适用机构<span class="arrow fa fa-sort-up"></span></a>
                </li>
            </ul>
            <div class="table-bar">
                <div class="search-form fl cf">
                    <form id="myForm" name="myForm" action="${BasePath}/order/product/list?${PublicParams}" method="post" class="form-inline">
                        机构名称：<input type="text" name="insName" value="${insName}"/>
                        产品名：<input type="text" name="name" value="${name}"/>
                        <input type="submit" value="查询" class="btn btn-success " style="margin-top: -10px"/>
                        <input type="hidden" name="start" id="start" value="${start }"/>
                        <input type="hidden" name="limit" id="limit" value="${limit }"/>
                    </form>
                </div>
            </div>
            <div class="data-table">
                <div class="table-striped">
                    <table cellspacing="1">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>产品名称</th>
                            <th>机构名称</th>
                            <th>价格</th>
                            <th>销售价</th>
                            <th>代理价</th>
                            <th>底价</th>
                            <th>是否在售</th>
                            <%--<th>网站显示</th>--%>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="bean">
                            <tr>
                                <td class="id">${bean.id}</td>
                                <td>${bean.name}</td>
                                <td>${bean.institutionName}</td>
                                <td>${bean.price}</td>
                                <td>${bean.salePrice}</td>
                                <td>${bean.agentPrice}</td>
                                <td>${bean.basePrice}</td>
                                <td>
                                    <c:choose>
                                        <c:when test="${bean.onsale==1}">
                                            <span style="color: green">是</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span style="color: red">否</span>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <%--<td>${bean.onsale}</td>--%>
                                <td>
                                    <pe:permission key="update">
                                        <a href="${BasePath}/order/product/toEdit?id=${bean.id}&${PublicParams}">修改</a>
                                    </pe:permission>
                                    <pe:permission key="delete">
                                        <a class="confirm ajax-get" href="${BasePath}/order/product/multiDel?ids=${bean.id}&${PublicParams}" redirect-url="${BasePath}/order/product/list?${PublicParams}">删除</a>
                                    </pe:permission>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="page" id="pager"></div>
                    <script type="text/javascript">
                        var sign = 0;
                        window.onload = function () {
                            PAGER.initPager('${start}', '${total}', '${limit}', 8, 'pager', getData);
                        }
                        function getData(currentPage, pageSize) {
                            if (sign > 0) {
                                $("#start").val(currentPage);
                                $("#limit").val(pageSize);
                                $("#myForm").submit();
                            }
                            sign = 1;
                        }
                    </script>
                </div>
            </div>
        </section>
    </div>
</div>
<jsp:include page="../../include/bottom.jsp"/>